
{volist name="$addonFieldExtList" id="vo"}
{if (!isset($vo.ifeditable) || $vo.ifeditable) && ($vo.ifsystem == 0)}
{switch name="vo.dtype"}
{case value="hidden"}
<!-- 隐藏域 start -->
<div class="layui-form-item none">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <input type="hidden" class="layui-input" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 隐藏域 start -->
{/case}

{case value="region"}
<!-- 区域选项 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        {volist name="$vo.dfvalue" id="v2"}
        <input type="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if} title="{$v2}">
        <input type="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2['id']}" {if condition="isset($vo['trueValue']) AND in_array($v2['id'], $vo['trueValue'])"} checked {/if} title="{$v2['name']}">
        {/volist}
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 区域选项 end -->
{/case}

{case value="text"}
<!-- 单行文本框 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <input type="text" class="layui-input" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
    </div>
    <div class="layui-input-inline layui-input-company">
        {$vo.dfvalue_unit|default=''}
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 单行文本框 end -->
{/case}

{case value="multitext"}
<!-- 多行文本框 start -->
<div class="layui-form-item layui-form-text">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <textarea id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" class="layui-textarea">{$vo.dfvalue|default=''}</textarea>
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 多行文本框 end -->
{/case}

{case value="checkbox"}
<!-- 复选框 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline w500">
        {volist name="$vo.dfvalue" id="v2"}
        <input type="checkbox" lay-skin="primary" lay-filter="addonFieldExt" name="{$vo.fieldArr}[{$vo.name|default=''}][]" data-callback="func_{$vo.name}_eyempty" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if} title="{$v2}">
        {/volist}
        <input type="hidden" name="{$vo.fieldArr}[{$vo.name}_eyempty]" value="{if condition="!empty($vo['trueValue'])"}1{else /}0{/if}">
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<script type="text/javascript">
    function func_{$vo.name}_eyempty()
    {
        var len = $("input[name='{$vo.fieldArr}[{$vo.name}][]']:checked").length;
        $("input[name='{$vo.fieldArr}[{$vo.name}_eyempty]']").val(len);
    }
</script>
<!-- 复选框 end -->
{/case}

{case value="radio"}
<!-- 单选项 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        {volist name="$vo.dfvalue" id="v2"}
        <input type="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if} title="{$v2}">
        {/volist}
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 单选项 end -->
{/case}

{case value="switch"}
<!-- 开关 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-block">
        <input type="checkbox" id="{$vo.fieldArr}[{$vo.name|default=''}]" lay-filter="{$vo.fieldArr}[{$vo.name|default=''}]" lay-skin="switch" lay-text="是|否" {if condition="0 != $vo['dfvalue']"}value="1" checked {/if}>
        <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default='0'}" />
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 开关 end -->
{/case}

{case value="select"}
<!-- 下拉框 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <select name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}">
            {volist name="$vo.dfvalue" id="v2"}
            <option value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}selected{/if}>{$v2}</option>
            {/volist}
        </select>
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 下拉框 end -->
{/case}

{case value="img"}
<!-- 单张图 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <div class="upload-box">
            <div class="upload-img fl">
                <div class="icaction none">
                              <span class="load_images">
                                 <a href="javascript:void(0);" onclick="BigImages($('#img_{$vo.fieldArr}_{$vo.name|default=''}_eyou_local').attr('src'));">
                                 <i class="layui-icon layui-icon-search mr5"></i>查看
                                 </a>
                              </span>
                    <span class="load_images">
                                <a href="javascript:void(0);" data-inputid="{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" onclick="DelImages(this);">
                                <i class="layui-icon layui-icon-delete mr5"></i>删除
                                </a>
                              </span>
                </div>
                <div class="cover-bg none"></div>
                <img id="img_{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" src="{$vo[$vo['name'].'_eyou_local']|get_default_pic=###}">
            </div>
            <div class="upload-right fl">
                <button class="layui-btn test-upload-demoMore layui-btn-primary layui-btn-sm fl mb10 mr5" lay-data="{number:1,ey_inputId:'{$vo.fieldArr}_{$vo.name|default=''}_eyou_local',ey_savepath:'allimg'}"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                <button class="layui-btn layui-btn-sm layui-btn-primary layui-btn-sm fl mb10" onClick="GetPictureFolder(1,'{$vo.fieldArr}_{$vo.name|default=''}_eyou_local');"><i class="layui-icon">&#xe64a;</i>图库</button>
                <input name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_local]" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" placeholder="图片地址" value="{$vo[$vo['name'].'_eyou_local']|default=''}" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-input-inline layui-btn-container" style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 单张图 end -->
{/case}

{case value="imgs"}
<!-- 多张图 start -->
<div class="layui-form-item ">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline layadmin-layer-demo">
        <button class="layui-btn multi-upload-demoMore layui-btn-sm fl" lay-data="{number:100,ey_savepath:'allimg',ey_callback:'{$vo.fieldArr}_{$vo.name|default=''}_call_back'}"><i class="layui-icon">&#xe67c;</i>上传图片</button>
        <button class="layui-btn layui-btn-sm fl" onClick="GetPictureFolder(100,'{$vo.fieldArr}_{$vo.name|default=''}','{$vo.fieldArr}_{$vo.name|default=''}_call_back');"><i class="layui-icon">&#xe64a;</i>图库</button>
    </div>
</div>
<div class="layui-form-item " id="dl_{$vo.fieldArr}_{$vo.name|default=''}">
    <label class="layui-form-label"></label>
    <div class="edit-box-con2 fl sort-list-{$vo.fieldArr}_{$vo.name|default=''}">
        {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
        <div class="images-upload">
            <div class="upimg">
                <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2}">
                <a class="del-bt" href="javascript:void(0);" style="color:white;" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2}');">删除</a>
                <div class="cover-bg2" style="display: block"></div>
                <img src="{$v2}">
            </div>
        </div>
        {/volist}
    </div>
</div>
<!-- 上传图片显示的样板 start -->
<div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl none">
    <div class="images-upload">
        <div class="upimg">
            <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="">
            <a class="del-bt" href="javascript:void(0);" style="color:white;">&nbsp;&nbsp;</a>
            <div class="cover-bg2" style="display: block"></div>
            <img src="">
        </div>
    </div>
</div>
<!-- 上传图片显示的样板 end -->
<script type="text/javascript">
    // 上传多图回调函数
    function {$vo.fieldArr}_{$vo.name|default=''}_call_back(pathObj){
        if (Array.isArray(pathObj)){
            var paths = pathObj;
        }else{
            var paths = [pathObj.url];
        }
        var  last_div = $(".{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl").html();
        for (var i=0;i<paths.length ;i++ )
        {
            $("#dl_{$vo.fieldArr}_{$vo.name|default=''}").find(".images-upload:eq(0)").before(last_div);  // 插入一个 新图片
            $("#dl_{$vo.fieldArr}_{$vo.name|default=''}").find(".images-upload:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
            $("#dl_{$vo.fieldArr}_{$vo.name|default=''}").find(".images-upload:eq(0)").find('a:eq(0)').attr('onclick',"{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $("#dl_{$vo.fieldArr}_{$vo.name|default=''}").find(".images-upload:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        }
    }

    /*
     * 上传之后删除组图input
     * @access   public
     * @val      string  删除的图片input
     */
    function {$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(obj,path)
    {
        // 删除数据库记录
        $.ajax({
            type:'GET',
            url:"{:url('Field/del_channelimgs')}",
            data:{filename:path,channel:"{$channeltype|default='0'}",fieldname:"{$vo.name}",aid:"{$aid|default='0'}",_ajax:1},
            success:function(){
                $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
                $.ajax({
                    type:'GET',
                    url:"{:url('Uploadify/delupload')}",
                    data:{action:"del", filename:path,_ajax:1},
                    success:function(){}
                });
            }
        });
    }

    /** 以下 产品相册的拖动排序相关 js*/
    $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).sortable({
        start: function( event, ui) {

        }
        ,stop: function( event, ui ) {

        }
    });
    $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).disableSelection();
</script>
<!-- 多张图 end -->
{/case}

{case value="int"}
<!-- 整数类型 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <input type="text" value="{$vo.dfvalue|default='0'}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="只允许纯数字" class="layui-input" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9]/g,''));">
    </div>
    <div class="layui-input-inline layui-input-company">
        {$vo.dfvalue_unit|default=''}
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 整数类型 end -->
{/case}

{case value="float"}
<!-- 小数类型 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <input type="text" value="{$vo.dfvalue|default='0'}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="允许带有小数点的数值" class="layui-input" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));">
    </div>
    <div class="layui-input-inline layui-input-company">
        {$vo.dfvalue_unit|default=''}
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 小数类型 end -->
{/case}

{case value="decimal"}
<!-- 金额类型 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <input type="text" value="{$vo.dfvalue|default='0.00'}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="允许带有小数点的数值" class="layui-input" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));">
    </div>
    <div class="layui-input-inline layui-input-company">
        {$vo.dfvalue_unit|default=''}
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<!-- 金额类型 end -->
{/case}

{case value="datetime"}
<!-- 日期和时间 start -->
<div class="layui-form-item">
    <label class="layui-form-label">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</label>
    <div class="layui-input-inline">
        <input type="text" class="layui-input" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" value="{$vo['dfvalue']}">
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $('#{$vo.fieldArr}_{$vo.name|default=''}').layDate();
    });
</script>
<!-- 日期和时间 end -->
{/case}

{case value="htmltext"}
<!-- HTML文本 start -->
<div class="layui-form-item">
    <span class="edit-box-tit">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<b>*</b>{/if}{$vo.title|default=''}</span>
    <div class="edit-box-con ">
        <div class="edit-box-textarea2">
            <textarea  class="ckeditor" id="{$vo.fieldArr}_{$vo.name|default=''}" data-func="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]">{$vo.dfvalue|default=''}</textarea>
        </div>
    </div>
    <div class="layui-input-inline layui-btn-container " style="width: auto;">
        <div class="layui-form-mid layui-word-aux ey_helptips"></div>
        <div class="layui-form-inline2 ey_helptips_txt">{$vo.remark|default=''}</div>
    </div>
</div>
<script type="text/javascript">
    UE.getEditor('{$vo.fieldArr}_{$vo.name|default=''}',{
        serverUrl :"{:url('Ueditor/index',array('savepath'=>'ueditor'))}",
        zIndex: 999,
        initialFrameWidth: "100%", //初化宽度
        initialFrameHeight: 450, //初化高度
        focus: false, //初始化时，是否让编辑器获得焦点true或false
        maximumWords: 99999,
        removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
        pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
        autoHeightEnabled: false,
        toolbars: ueditor_toolbars
    });

    //必须在提交前渲染编辑器；
    function {$vo.fieldArr}_{$vo.name|default=''}() {
        //判断编辑模式状态:0表示【源代码】HTML视图；1是【设计】视图,即可见即所得；-1表示不可用
        if(UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").queryCommandState('source') != 0) {
            UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('source'); //切换到【设计】视图
        }
    }
</script>
<!-- HTML文本 end -->
{/case}
{/switch}
{/if}
{/volist}